package com.itheima.sparkml.exercise

import breeze.linalg.Matrix
import org.apache.spark.mllib.linalg
import org.apache.spark.mllib.linalg.{Matrices, Vectors}

object _6LocalMatrix {
  def main(args: Array[String]): Unit = {
    val matrix: linalg.Matrix = Matrices.dense(3,2,Array(2,3,5,1.0,2.5,2.4))
    val matrix2 = Matrices.diag(Vectors.dense(1.0,2.0,3.0))
    println(matrix2)
    val matrix3 = Matrices.eye(5)
    println(matrix3)
    println("matrix:\n", matrix2)
    println("matrix 0 0 value is:", matrix2(0, 0)) //2
    println("matrix 0 0 value is:", matrix2(1, 1)) //2.5
  }
}
